<!--Descriptive page name, messages and instructions-->
<h2><%= ts('Change My User Name') %></h2>
<%= error_messages_for :user %>
<!--/descriptions-->

<!--main content-->
<p><%= ts("Please use this feature with caution. We will not redirect your old user name to your new one. Bookmarks and external links to your user page and your pseud pages under the old name will no longer work and the old name may be used by someone else unless all you are changing is capitalization.") %></p>
<p><%= ts("If that is not what you want, you can") %> <%= link_to ts("create a new Pseud"), new_user_pseud_path(@user) %> <%= ts("instead.") %></p>

<%= form_tag change_username_user_path(@user) do %>  
  <dl>
    <dt><%= ts("Current User Name") %></dt>
      <dd><strong><%= @user.login %></strong></dd>
    <dt><%= label_tag :new_login, ts("New User Name") %></dt>
      <dd><%= text_field_tag :new_login, @new_login %></dd>
    <%= live_validation_for_field('new_login', 
      :exclusion => User.find(:all, :select => :login).map{|user| user.login}, 
      :failureMessage => ts("username already taken"),
      :validMessage => ts("username available")) %>
  </dl>
  <dl id="passwd">
    <dt><%= label_tag :password, ts("Re-enter Your Password") %></dt>
      <dd><%= password_field_tag :password %></dd>
  </dl>
  
  <p class="submit">
    <%= submit_tag "Change" %>
  </p>
<% end %>
<% if @wrong_password %>
  <div class="clear"></div>
  <p class="footnote">
    <%= ts("If you've forgotten your password, we can send you a temporary one.") %>
  <p>
  <%= form_tag passwords_path do %>
    <%= hidden_field_tag 'login', @user.login %>
    <p class="footnote">
      <%= submit_tag ts('Reset my password', :class => 'submit') %>
    <p>
  <% end %>
<% end %>

<hr class="clear" />
